package com.nzw.security.credential;

import com.nzw.common.Constant;
import com.nzw.security.token.UserToken;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;

/**
 * Created by XuZhanSi on 2016/12/27 0027.
 */
public class CustomCredentials extends SimpleCredentialsMatcher {

    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
        UserToken userToken= (UserToken) token;
        if (userToken.getUserType()== Constant.WX_LOGIN)//微信用户不需要账号密码
            return true;
        //微信用户不需要登录，直接返回true
        return false;
    }
}
